<%@ include file="/common/include.jsp"%>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<jsp:include page="../../../common/head.jsp">
			<jsp:param name="_useCalendar" value="true"/>
		</jsp:include>
		<script language="javascript">
	function saveinfo()
	{
		var objarr = new Array(
			["orgOrganization.orgName","组织机构名称","notEmpty",""],
			["orgOrganization.orgName","组织机构名称","max","String:100"],
			["orgOrganization.orgCode","组织机构代码","max","String:50"],
			["orgOrganization.suggestCode","快速检索码","notEmpty",""],
			["orgOrganization.suggestCode","快速检索码","max","String:100"],
			["orgOrganization.orgOrder","组织机构排序","notEmpty",""],
			["orgOrganization.orgOrder","组织机构排序","int","20"],
			["orgOrganizationExtend.homePage","主页","max","String:100"],
			["orgOrganizationExtend.faxNo","传真","max","String:50"],
			["orgOrganizationExtend.email","电子邮件地址","max","String:50"],
			["orgOrganizationExtend.telNo","电话","max","String:50"],
			["orgOrganizationExtend.legalPerson","法人代表","max","String:50"]
		);
	
		if(xj.CheckAll(objarr))
		{
			if(confirm("确认保存？"))
			{
				var tmp = parseInt(Math.random()*10000+1);//设定随机数防止浏览器以相同url重复多次访问不进行请求
				var url = 'checkExistsOrganization.do?orgId='+$("orgId").val()+"&tmp="+tmp;
				$.get(url, {},function (data, textStatus){
					if(data=="ok")
					{
						document.form1.submit();
					}
					else
					{
						alert("组织机构代码重复，请重新设置！");
					}
				});
			}
		}
	}
	function getSuggectCode()
	{
		var tmp = parseInt(Math.random()*10000+1);//设定随机数防止浏览器以相同url重复多次访问不进行请求
		var url = 'getSuggestCodeOrganization.do?orgName='+$("#orgName").val()+"&tmp="+tmp;
		$.get(encodeURI(url), {},function (data, textStatus){
			$("#suggestCode").val(data);
		});
	}
</script>

		<title>修改组织结构信息</title>
	</head>
	<body>
		<form action="updateOrganization.do" name="form1" method="post">
			<div id="body_div">
				<w:ShowTitle name="修改组织结构信息">
					<w:TitleButton funcName="保存" onClickFunction="saveinfo()" urlImg="${ctx}/images/main/save.png" funcType="link" hideCondition="${fn:indexOf(orgOrganization.orgId,'999')!=-1}"/>
				</w:ShowTitle>
				<div id="body_content">
					<table width="100%">
						<c:if test="${fn:indexOf(orgOrganization.orgId,'999')!=-1}">
						<tr>
							<td class="left_align" colspan="4">
									初始部门不能修改
							</td>
						</tr>
						</c:if>
						<tr>
							<td class="right_align" width="150">
								上级ID
							</td>
							<td class="left_align" width="220">
								${orgOrganization.orgPid}
								<input type="hidden" name="orgOrganization.orgPid" id="orgPid" readonly="readonly" value="${orgOrganization.orgPid}"/>
							</td>
							<td class="right_align" width="150">
								上级名称
							</td>
							<td class="left_align">
								${pOrgOrganization.orgName }
							</td>
						</tr>
						<tr>
							<td class="right_align">
								组织结构ID
							</td>
							<td class="left_align">
								${orgOrganization.orgId}
								<input type="hidden" name="orgOrganization.orgId" id="orgId" value="${orgOrganization.orgId}"/>
							</td>
							<td class="right_align">
								组织结构名称
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganization.orgName" id="orgName" onblur="getSuggectCode()" value="${orgOrganization.orgName }"/>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								所属系统
							</td>
							<td class="left_align">
								<w:select name="orgOrganization.belongsSystem" value="${orgOrganization.belongsSystem}">
									<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="kindId" filterFieldValue="028"></w:options>
								</w:select>
							</td>
							<td class="right_align">
								组织结构类型
							</td>
							<td class="left_align">
								<w:select name="orgOrganization.orgType" value="${orgOrganization.orgType}">
									<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="kindId" filterFieldValue="029"></w:options>
								</w:select>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								组织机构层级
							</td>
							<td class="left_align">
								<w:select name="orgOrganization.orgLevel" value="${orgOrganization.orgLevel}">
									<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="kindId" filterFieldValue="030"></w:options>
								</w:select>
							</td>
							<td class="right_align">
								组织机构编码
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganization.orgCode" value="${orgOrganization.orgCode}"/>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								快速选择码
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganization.suggestCode" id="suggestCode" value='${orgOrganization.suggestCode}'/>
							</td>
							<td class="right_align">
								排序
							</td>
							<td class="left_align">
								<input type="hidden" name="oldOrder" value="${orgOrganization.orgOrder}"/>
								<input type="text" name="orgOrganization.orgOrder" value="${orgOrganization.orgOrder}"/>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								法人代表
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.legalPerson" value="${orgOrganizationExtend.legalPerson}"/>
							</td>
							<td class="right_align">
								公司联系电话
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.telNo" value="${orgOrganizationExtend.telNo}"/>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								传真
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.faxNo" value="${orgOrganizationExtend.faxNo}"/>
							</td>
							<td class="right_align">
								主页
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.homePage" value="${orgOrganizationExtend.homePage}"/>
							</td>
						</tr>
						<tr>
							<td class="right_align">
								E-mail
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.email" value="${orgOrganizationExtend.email}"/>
							</td>
							<td class="right_align">
								成立时间
							</td>
							<td class="left_align">
								<input type="text" name="orgOrganizationExtend.createDate" onclick="WdatePicker()" readonly="readonly" class="inputCal" value='<fmt:formatDate value="${orgOrganizationExtend.createDate}" pattern="yyyy-MM-dd"/>' />
							</td>
						</tr>
						<tr>
							<td class="right_align">
								在用状态
							</td>
							<td class="left_align">
								<w:select name="orgOrganization.state" value="${orgOrganization.state}" styleId="state">
									<w:option optionLabel="在用" optionValue="A"></w:option>
									<w:option optionLabel="停用" optionValue="P"></w:option>
								</w:select>
							</td>
							<td class="right_align">
								修改在岗人员组织机构信息
							</td>
							<td class="left_align">
								<input class="radio" type="radio" name="updateEmployee" value="是" checked="checked"/>是
								<input class="radio" type="radio" name="updateEmployee" value="否"/>否
							</td>
						</tr>
						<!-- 
						<tr>
							<td class="right_align">单位体制</td>
							<td class="left_align" colspan="3">
								<w:select name="orgOrganization.orgSystem" value="${orgOrganization.orgSystem}">
									<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="kindId" filterFieldValue="036"></w:options>
								</w:select>
							</td>
						</tr>
						 -->
						<tr>
							<td class="right_align">
								简介
							</td>
							<td colspan="3" class="left_align">
								<textarea cols="80" rows="8" name="orgOrganizationExtend.notes">${orgOrganizationExtend.notes}</textarea>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</form>
	</body>
</html>